<html>
<head>
<style type='text/css'>
body {
   background-color: white;
   margin: 1em 2em 1em 2em;
   font-family: Sans-Serif;
   color: #002;
   line-height: 140%;
   font-size: 12px;
}

h1 {
    font-size: 140%;
}

h2 {
    font-size: 130%;
}

h3 {
    font-size: 120%;
}

h4 {
    font-size: 100%;
    font-style: normal;
    font-weight: bold;
}

h5 {
    font-size: 100%;
    font-style: italic;
    font-weight: normal;
}

pre {
   background-color: #eee;
   padding: 0.5em 0.5em 0.5em 2em;
}

@media print {
   pre {word-wrap:break-word; width:100%;}
} 

ul li,
ol li {
   padding-left: 0.3em;
   /*text-indent: -2em;*/
   margin-bottom: 0.5em;
}

em {
   font-style: normal;
   font-weight: bold;
   text-decoration: underline;
   color: #c40;
}

code {
   font-family: Monospace;
   font-size: 100%;
   color: #c40;
}

a, a * {
   text-decoration: underline;
   color: #14a0d1;
   /* border: 0.5px solid #aaa;
   white-space: nowrap;
   padding-right: 0.1em;
   padding-left: 0.1em;
   padding-bottom: -5px; */
}

a code {
   color: #14a0d1;
}

img {
   position: relative;
   bottom: -4px;
}

div.headline {
   font-weight: bold;
   font-size: 110%;
}

div.copyright {
   margin-top: 1em;
   border-top: 1px solid black;
   padding-top: 0.5em;
}

div.iris_headline {
   border-bottom: 1px solid black;
   padding-bottom: 0.3em;
}

.LaTeX {
   font-family: Monospace;
   font-size: 100%;
   border: 1px solid #060;
   color: #060;
}

code.LaTeX {
   background-color: white;
   padding: 0.5em 0.5em 0.5em 2em;
}
</style>
</head>

<body>
<div class="iris_headline">IRIS Toolbox Reference Manual</div>




<h2 id="tseries/specrange">specrange</h2>
<div class="headline">Time series specific range</div>

<h4 id="syntax">Syntax</h4>
<pre><code>Rng = specrange(X,S)</code></pre>
<h4 id="input-arguments">Input arguments</h4>
<ul>
<li><p><code>X</code> [ tseries ] - Time series.</p></li>
<li><p><code>S</code> [ numeric | <code>@all</code> ] - Range specification; the output range <code>Rng</code> will be constructed from the first and the last element of <code>S</code> only.</p></li>
</ul>
<h4 id="output-arguments">Output arguments</h4>
<ul>
<li><code>Rng</code> [ numeric ] - Date range constructed from <code>S</code> specific to time series <code>X</code>.</li>
</ul>
<h4 id="description">Description</h4>
<p>The time series specific range is constructed as <code>startDate:endDate</code> where</p>
<ul>
<li><p>the start date <code>startDate</code> is <code>S(1)</code> if <code>S(1)</code> is a serial date number, or the start date of the input series <code>X</code> if <code>S(1)</code> is <code>Inf</code>, <code>-Inf</code>, or <code>@all</code>;</p></li>
<li><p>the end date <code>endDate</code> is <code>S(end)</code> if <code>S(end)</code> is a serial date number, or the end date of the input series <code>X</code> if <code>S(end)</code> is <code>Inf</code>, or <code>@all</code>.</p></li>
</ul>
<h4 id="example">Example</h4>
<p>Create a time series from <code>2000Q1</code> to <code>2001Q4</code></p>
<pre><code>&gt;&gt; x = tseries( qq(2000,1):qq(2001,4), @rand );</code></pre>
<p>The function <code>specrange</code> returns the full range of the time series when <code>S</code> is <code>Inf</code></p>
<pre><code>&gt;&gt; dat2str( specrange(x,Inf) )
ans = 
    Columns 1 through 6
    &#39;2000Q1&#39;    &#39;2000Q2&#39;    &#39;2000Q3&#39;    &#39;2000Q4&#39;    &#39;2001Q1&#39;    &#39;2001Q2&#39;
    Columns 7 through 8
    &#39;2001Q3&#39;    &#39;2001Q4&#39;</code></pre>
<p>or when <code>S</code> is <code>[-Inf,Inf]</code></p>
<pre><code>&gt;&gt; dat2str( specrange(x,[-Inf,Inf]) )
ans = 
    Columns 1 through 6
    &#39;2000Q1&#39;    &#39;2000Q2&#39;    &#39;2000Q3&#39;    &#39;2000Q4&#39;    &#39;2001Q1&#39;    &#39;2001Q2&#39;
    Columns 7 through 8
    &#39;2001Q3&#39;    &#39;2001Q4&#39;</code></pre>
<p>or when <code>S</code> is <code>@all</code></p>
<pre><code>&gt;&gt; dat2str( specrange(x,@all) )
ans = 
    Columns 1 through 6
    &#39;2000Q1&#39;    &#39;2000Q2&#39;    &#39;2000Q3&#39;    &#39;2000Q4&#39;    &#39;2001Q1&#39;    &#39;2001Q2&#39;
    Columns 7 through 8
    &#39;2001Q3&#39;    &#39;2001Q4&#39;</code></pre>
<p>A range from the start of the time series to a specific date is returned when <code>S(1)</code> is <code>-Inf</code> and <code>S(end)</code> is that specific end date:</p>
<pre><code>&gt;&gt; dat2str( specrange(x,[-Inf,qq(2000,3)]) )
ans = 
    &#39;2000Q1&#39;    &#39;2000Q2&#39;    &#39;2000Q3&#39;</code></pre>
<p>A range from a specific date to the end of the time series is returned when <code>S(1)</code> is that specific start date date, and <code>S(end)</code> is <code>Inf</code>:</p>
<pre><code>&gt;&gt; dat2str( specrange(x,[qq(2000,3),Inf]) )
ans = 
    &#39;2000Q3&#39;    &#39;2000Q4&#39;    &#39;2001Q1&#39;    &#39;2001Q2&#39;    &#39;2001Q3&#39;    &#39;2001Q4&#39;</code></pre>

</body>
<div class="copyright">IRIS Toolbox. Copyright &copy; 2007-2015 IRIS Solutions Team.</div>
</html>
